
function repeat(fn, count, timer) {
    //? 这是个异步函数 需要等待one函数中的Promise返回结果(resolve)
    return async function (...args) {
        for (let i = 0; i < count; i ++) {
            await one(fn,timer,...args)
        }

    }
}
function one(fn, timer, ...args) {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            fn.apply(this,args)
            resolve()
        },timer)
    })
}


const repeatLog = repeat(console.log,5,1000)
repeatLog("hello world")

